<?php

class SlideController extends CommonController{
	
	private $_model;
	
	public function __init(){
		
		$this->_model=K('Slide');
	}
	
	public function index(){
		
		$data=$this->_model->get_all_data();
		
		$this->assign('data',$data);
		
		$this->display();
	}	
	
	public function add(){
		
		if(IS_POST){
			$this->_model->add_data();
			$this->success('添加成功');
		}
		
		$this->display();
	}
	
	public function edit(){
		
		if(IS_POST){
			
			$this->_model->edit_data(array('sid'=>Q('get.sid')));
			$this->success('修改成功',U('Slide/index'));
		}
		
		$data=$this->_model->get_one_data(array('sid'=>Q('get.sid')));
		
		$this->assign('data',$data);
		
//		p($data);
		$this->display();
	}
	
	public function del(){
		
		$this->_model->del_data(array('sid'=>Q('get.sid')));
		$this->success('删除成功');
	}
	
	
	
}








